import javax.swing.*;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.BlockingQueue;

public class Demo_801 {
    public static void main(String[] args) {
        //使用JDK提供的类，创建一个定时器
        Timer timer = new Timer();

        //向定时器中添加任务
        timer.schedule(new TimerTask(){
            public void run(){
                System.out.println("该起床了...");
            }
        },1000);

        timer.schedule(new TimerTask(){
            public void run(){
                System.out.println("任务2...");
            }
        },2000);

        timer.schedule(new TimerTask(){
            public void run(){
                System.out.println("任务3...");
            }
        },3000);

    }
}
